/*jslint browser: true, devel: true, bitwise: true, white: true, plusplus: true, nomen:true */
/*global $:true, define:true */

define(['WID/Test/Matchers'], function(Matchers) {
"use strict";
return {
	name:'MatchersCase', 
	desc:'Its testing matchers from Test Module',
	
	each: {
		matcher: null
	},
	
	beforeEach: function() {
		this.each.matcher = new Matchers();
	},
	
	tests:[
		function creating(each) {
			var m = each.matcher;
			this.expect(m.CurrentExpect).toBe(-1);
			this.expect(m.MatchLog).toBe('');
			this.expect(m.Target).toBeUndefined();
			this.expect(m.Negation).toBeFalse();
		},
		
		/*function toPrimitive(each) {
			var m = each.matcher;
			this.expect(m.toPrimitive({v1:'test',v2:false})).toBe('{"v1":"test","v2":false}');
		},*/
		
		function newExpect(each) {
			var m = each.matcher;
			m.newExpect(1,2);
			this.expect(m.Target).toBe(2);
			this.expect(m.CurrentExpect).toBe('<b>(1) Expected</b> ');
			this.expect(m.Negation).toBe(false);
		},
		
		function logFailure(each) {
			var m = each.matcher;
			m.CurrentExpect = 'T';
			m.logFailure('t');
			this.expect(m.MatchLog).toBe('Tt');
		},
		
		function notProperty(each) {
			var m = each.matcher;
			this.expect(m.not).toBe(m);
			this.expect(m.Negation).toBe(true);
		},
		
		function logProperty(each) {
			var m = each.matcher;
			m.MatchLog = 'test';
			this.expect(m.log).toBe('test');
			this.expect(m.MatchLog).toBe('');
		},
		
		function toBe() {
			this.expect(true).toBe(true);
			this.expect(true).not.toBe(false);
		},
		                  
		function toBeOnObject() {
			var t = {test1:1,test2:2};
			this.expect(t).toBe(t);
			this.expect(t).not.toBe({test:1,test2:2});
		},
		
		function toBeUndefined() {
			this.expect(undefined).toBeUndefined();
			this.expect({}).not.toBeUndefined();
		},           
		                  
		function toBeDefined() {
			this.expect({}).toBeDefined();
			this.expect(undefined).not.toBeDefined();
		},
		
		function toBeTrue() {
			this.expect(true).toBeTrue();
			this.expect(1).toBeTrue();
			this.expect(false).not.toBeTrue();
		},
		
		function toBeFalse() {
			this.expect(false).toBeFalse();
			this.expect('').toBeFalse();
			this.expect(true).not.toBeFalse();
		},
		
		function toBeInstanceOf() {
			function TestClass() {
				
			}
			var t = new TestClass();
			this.expect(t).toBeInstanceOf(TestClass);
			this.expect(t).not.toBeInstanceOf(Date);
		},
		
		function toBeType() {
			this.expect('test').toBeType(String);
			this.expect(1).toBeType(Number);
			this.expect(1).not.toBeType(String);
		},
		
		function toBeGreaterThan() {
			this.expect(1).toBeGreaterThan(0);
			this.expect(0).not.toBeGreaterThan(1);
		},
		
		function toBeGreaterThanOnObject() {
			this.expect({test:1}).toBeGreaterThan({test:0},function(v1,v2){
				return (v1.test > v2.test);
			});
			this.expect({test:0}).not.toBeGreaterThan({test:1},function(v1,v2){
				return (v1.test > v2.test);
			});
		},
		
		function toBeLessThan() {
			this.expect(0).toBeLessThan(1);
			this.expect(1).not.toBeLessThan(0);
		},
		
		function toBeLessThanOnObject() {
			this.expect({test:0}).toBeLessThan({test:1},function(v1,v2){
				return (v1.test < v2.test);
			});
			
			this.expect({test:1}).not.toBeLessThan({test:0},function(v1,v2){
				return (v1.test < v2.test);
			});
			
		},
		
		function toBeEqual() {
			this.expect(1).toBeEqual(1);
			this.expect(0).not.toBeEqual(1);
		},
		
		function toBeEqualOnObject() {
			this.expect({test:1}).toBeEqual({test:1}, function(v1,v2){
				return v1.test === v2.test;
			});
			this.expect({test:1}).not.toBeEqual({test:0}, function(v1,v2){
				return v1.test === v2.test;
			});
		}
	]
};
});
